﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;
using System.Xml.Serialization;

namespace LI4
{
    /// <summary>
    /// Summary description for Webservices
    /// </summary>
    [WebService(Namespace = "http://localhost/MyWebServices/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    public class Webservices : System.Web.Services.WebService
    {

        [WebMethod]
        [XmlInclude(typeof(Business.Curso)), XmlInclude(typeof(Business.Area)), XmlInclude(typeof(Business.Localidade)), XmlInclude(typeof(Business.Distrito))]
        public List<Business.Curso> getCursosLocalidade(int i)
        {
            Data.WebServices dataWS = new LI4.Data.WebServices();
            List<Business.Curso> arr = new List<LI4.Business.Curso>();
            arr = dataWS.getCursosLocalidade1(i);
            return arr;
            //return  dataC.getCursosLocalidade(i);
        }

        [WebMethod]
        [XmlInclude(typeof(Business.Curso)), XmlInclude(typeof(Business.Area)), XmlInclude(typeof(Business.Localidade)), XmlInclude(typeof(Business.Distrito))]
        public List<Business.Curso> getCursosNome(string nomec)
        {
            Data.WebServices dataWS = new LI4.Data.WebServices();
            return dataWS.getCursosNome(nomec);

        }



        [WebMethod]
        [XmlInclude(typeof(Business.Curso)), XmlInclude(typeof(Business.Area)), XmlInclude(typeof(Business.Localidade)), XmlInclude(typeof(Business.Distrito))]
        public List<Business.Curso> getCursosArea(int areac)
        {
            Data.WebServices dataWS = new LI4.Data.WebServices();
            return dataWS.getCursosArea(areac);

        }
        [WebMethod]
        [XmlInclude(typeof(Business.Curso)), XmlInclude(typeof(Business.Area)), XmlInclude(typeof(Business.Localidade)), XmlInclude(typeof(Business.Distrito))]
        public Business.Curso getCursoNome(string nomec)
        {
            Data.WebServices dataWS = new LI4.Data.WebServices();
            return dataWS.getCursoNome(nomec);
        }

        [WebMethod]
        [XmlInclude(typeof(Business.Anuncio)), XmlInclude(typeof(Business.Area)), XmlInclude(typeof(Business.Localidade)), XmlInclude(typeof(Business.Distrito))]
        public List<Business.Anuncio> getAnuncios(string username)
        {
            Data.WebServices dataWS = new LI4.Data.WebServices();
            return dataWS.getAnuncios(username);
        }

        [WebMethod]
        [XmlInclude(typeof(Business.Anuncio)), XmlInclude(typeof(Business.Area)), XmlInclude(typeof(Business.Localidade)), XmlInclude(typeof(Business.Distrito))]
        public List<Business.Anuncio> getAnunciosArea(int areac)
        {
            Data.WebServices dataWS = new LI4.Data.WebServices();
            return dataWS.getAnunciosArea(areac);
        }

        [WebMethod]
        [XmlInclude(typeof(Business.Anuncio)), XmlInclude(typeof(Business.Area)), XmlInclude(typeof(Business.Localidade)), XmlInclude(typeof(Business.Distrito))]
        public List<Business.Anuncio> getAnunciosLocalidade(int localidadec)
        {
            Data.WebServices dataWS = new LI4.Data.WebServices();
            return dataWS.getAnunciosLocalidade(localidadec);
        }

        [WebMethod]
        [XmlInclude(typeof(Business.Anuncio)), XmlInclude(typeof(Business.Area)), XmlInclude(typeof(Business.Localidade)), XmlInclude(typeof(Business.Distrito))]
        public Business.Anuncio getAnuncio(int codigo)
        {
            Data.WebServices dataWS = new LI4.Data.WebServices();
            return dataWS.getAnuncio(codigo);
        }
        [WebMethod]
        [XmlInclude(typeof(Business.Localidade)), XmlInclude(typeof(Business.Distrito))]
        public List<Business.Localidade> getLocalidades()
        {
            Data.WebServices dataWS = new LI4.Data.WebServices();
            return dataWS.getLocalidades();
        }

        [WebMethod]
        [XmlInclude(typeof(Business.Distrito))]
        public List<Business.Distrito> getDistritos()
        {
            Data.WebServices dataWS = new LI4.Data.WebServices();
            return dataWS.getDistritos();   
        }

        [WebMethod]
        [XmlInclude(typeof(Business.Area))]
        public List<Business.Area> getAreas()
        {
            Data.WebServices dataWS = new LI4.Data.WebServices();
            return dataWS.getAreas();
        }
    }
}
